home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / desktop / winrun.zip / WINRUN.C < prev    next >
C/C++ Source or Header  |  1991-03-23  |  2KB  |  88 lines

  1. /****************************************************************************
  2.  
  3. Program:    WINRUN.C
  4.  
  5. History:    Mon  03-18-1991  bd  Created
  6.             Sat  03-23-1991  bd  Modified for Optional Command LIne Param
  7.  
  8. Use:        Utility for use with Program Manager File Property Command Line
  9.  
  10. Example:    {directory}WINRUN {-option} normal_command_line
  11.  
  12. Options:    -option parameter can be set to:
  13.  
  14.                 STD - same as leaving option off command line
  15.                 MIN - activate app and minimize window
  16.                 MAX - activate app and maximize window
  17.  
  18. Author:     Bob Duffett
  19.             Priority Software, Inc.
  20.             P.O. Box 5548
  21.             Athens, GA  30604
  22.  
  23.             (404) 548-4039 Voice
  24.             (404) 543-7250 FAX
  25.             (404) 543-3162 MHS Hub (PSI-GA)
  26.             
  27. Build:      cl -c -AS -Gsw -Owx -Zpe -W4 winrun.c
  28.             link /nod winrun,,, libw slibcew, winrun.def
  29.             rc winrun.res
  30.  
  31. ****************************************************************************/
  32.  
  33. #include "windows.h"
  34.  
  35. #define NOREF(x) x=x
  36.  
  37. int PASCAL WinMain
  38.   ( HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
  39.   {
  40.   int nParam = nCmdShow;
  41.  
  42.   NOREF( hInstance );
  43.   NOREF( hPrevInstance );
  44.  
  45.   if( lpCmdLine[0] == '-' )
  46.     {
  47.     if( lstrlen(lpCmdLine) <= 6 || lpCmdLine[4] != ' ' )
  48.         goto BotchedCommandLine;
  49.  
  50.     lpCmdLine += 3;
  51.  
  52.     if( *lpCmdLine == 'D' || *lpCmdLine == 'd' )
  53.         ;
  54.     else
  55.     if( *lpCmdLine == 'N' || *lpCmdLine == 'n' )
  56.         nParam = SW_SHOWMINIMIZED;
  57.     else
  58.     if( *lpCmdLine == 'X' || *lpCmdLine == 'x' )
  59.         nParam = SW_SHOWMAXIMIZED;
  60.     else
  61.         goto BotchedCommandLine;
  62.  
  63.     lpCmdLine += 2;
  64.     }
  65.  
  66.   if( *lpCmdLine == '\0' )
  67.     return FALSE;
  68.  
  69.   return WinExec( lpCmdLine, nParam );
  70.  
  71. BotchedCommandLine:
  72.  
  73.     MessageBox(
  74.         NULL,
  75.         "Problem: Invalid 'option' parameter\n"
  76.         "\n"
  77.         "Syntax:\n"
  78.         "\240\240{directory}WINRUN\240{-option}\240normal_command_line\n"
  79.         "\n"
  80.         "Where:\n"
  81.         "  option is STD, MIN or MAX\n",
  82.         "WINRUN Error Message",
  83.         MB_ICONASTERISK | MB_OK );
  84.  
  85.     return FALSE;
  86.     }
  87.  
  88.